/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Socket;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;

/**
 *
 * @author hcc25_000
 */
public class Client {
    public static void main(String[] args){
        BufferedReader br=null;
        PrintWriter pw=null;
        try{
            Socket socket =new Socket("localhost",2000);
            
            br=new BufferedReader(new InputStreamReader(socket.getInputStream()));
            pw=new PrintWriter(socket.getOutputStream(),true);
            
            pw.println("hello");
            pw.println("cc");
            String s=null;
            while(true){
                s=br.readLine();
                if(s!=null){
                    break;
                }
            }
            System.out.println(s);
        } catch (IOException ex) {
            
        }finally{
            try{
                br.close();
                pw.close();
            }catch(IOException e){
                e.printStackTrace();
            }
        }
    }
}
